<%-- 
    Document   : Docente
    Created on : 2-mag-2012, 14.15.49
    Author     : Ihsan Younes
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Utils.Corso "%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Corsi</title>

<link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <!-- Chiamata al css contenente la grafica -->
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.8.19.custom.css" >
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js" ></script>
  
<jsp:useBean id = "Dettagli_corsi" class="Utils.Corsi_tenuti_docente" scope="request"> </jsp:useBean>
    <jsp:useBean id = "studenti" class="java.util.List <Utils.Studenti_Corsi_Iscrizioni>" scope="request"> </jsp:useBean>
    <jsp:useBean id = "corsi" class="java.util.List <Utils.Corsi_tenuti_docente>" scope="request"> </jsp:useBean>
    <jsp:useBean id = "docente" class="Boolean" scope="request"> </jsp:useBean>


<script>
            $(document).ready(function (){
                var x = $(document).height();
                $('#Bottom_bar').css("top", (x+118)+"px");
                $('#Menu_background').css("height" , x+"px");
               $('#tabs li:eq(0) a').tab('show');
            });

</script> 

  
  <script type="text/javascript">
      $(function() {
		$("a.cambiavoto").click(function(event) {
                    
                    
                    
                    var x = $(this).parent().attr("id");
                    
                    $(this).parent().html(
             
   "<form method=\"post\" action=\"Corsi_Docente\">"
   +"<fieldset>"
   +"<input type=\"radio\" name=\"approved\" value=\"approvato\" checked>approvato<br> "
   +"<input type=\"radio\" name=\"approved\" value=\"non approvato\">non appprovato" 
   +"</fieldset> "
   +"<input type=\"text\" class=\"input-small\" name=\"voto\" value =\"0\">"
   +"<input type=\"submit\" value=\"Canc\" name=\"operazione\">"
   +"<input type=\"submit\" value=\"OK\" name = \"operazione\"> "
   +"<input type=\"hidden\" name =\"student\" value=\""+x+"\">"
   +"<input type=\"hidden\" name =\"ID\" value=\"<% out.append(""+Dettagli_corsi.getId()); %>\" >"
   +"</form>"
   );

            })
	});
        
</script>


  
   <style type="text/css">
        #selectable .ui-selecting { background: #FFFFFF; }
	#selectable .ui-selected { background: #99CBFF; color: black; border: #34FF12; }
</style>

<script type="text/javascript">
	$(function() {
		$("#selectable").selectable(
                { filter : 'tr',                 
                  stop: function() 
                    {
                        
                        str = ($(".ui-selected",this).attr("id"));
                            if(str.match("Row-0"))
                                    $(".ui-selected",this).removeClass("ui-selected");
                            else
                                {
                                document.location.href = "Corsi_Docente?ID="+get_selected_index();
                                }
			$(".ui-selected",this).each(function() {
                               $(this).siblings().removeClass("ui-selected");         
		     })}})
	});
        
       function get_selected_index(){
         var elim = document.getElementById(str);
         var x = elim.id;
         return x;
       }
 
</script>
</head>

<body>
    
    
    
    
<div id="Menu_background"> </div>
<div id="Top_bar"> </div>
<div id="Bottom_bar"> </div>

<div id="Header">

	<div id="LOGO_UNITN" class="image" style="position:absolute;left:26px;top:15px;width:339px;height:93px;z-index:0;padding:0;">
	<img src="images/logo_unitn1.gif" id="Image1" alt="" border="0" style="width:339px;height:93px;"></div>

</div>

<div id="SlideMenu1">
<ul class="nav nav-list">
  <li class="nav-header">
    Docente
  </li>
  <li class="active">
    <a href="Corsi_Docente">Corsi</a>
  </li>
  <li>
    <a href="Advisor">Advisor</a>
  </li>
  <li>
    <a href="Logout">Logout</a>
  </li>
</ul>
</div>

<div style="position:absolute;left:190px;top:162px">
    <h3>Corsi tenuti</h3>
</div>

<table class="table table-bordered" id="selectable" style="cursor: pointer;position:absolute;left:190px;top:190px;width:254px">
<tr id ="Row-0" class="table_header">
    <th>
        Nome Corso
    </th>
</tr>

 <c:choose>
                                <c:when test="${corsi == null}">
                                    <tr><td>Nessun corso associato</td></tr>
                                </c:when>
                                <c:otherwise>
                                    <c:forEach items="${corsi}" var="corso">
                                          <tr id="${corso.id}">
                                                <td><c:out value="${corso.nome}"/></td>
                                            </tr>            
                                    </c:forEach>
                                </c:otherwise>
</c:choose>


 
                        
</table>

<div style="position:absolute;left:480px;top:190px;">
    
    <ul class="nav nav-tabs" id="tabs">
        <li><a href="#tab1" data-toggle="tab"><h4>Informazioni corso</h4></a></li>
        <li><a href="#tab2" data-toggle="tab"><h4>Studenti Corso</h4></a></li>
    </ul> 
        
    <div class="tab-content"> 
        
    <div class="tab-pane" id="tab1">
    
        <button class="btn" type="button" onClick="location.href='./Modifica_corsi.html'" id="modifica_corsi">
            Modifica
        </button><br><br>
        
        <table class="table table-bordered" style="width:688px"id="Table_corsi">
		<tr>
		<th colspan="2">
		Informazioni corso
		</th>
		</tr>
		<tr>
		<td>
		Nome Corso
		</td>
                <td>
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="nome"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Periodo
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="periodo"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Crediti
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="crediti"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Data inizio lezioni
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="data_inizio"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Aula lezioni
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="aula_lezioni"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Numero iscritti
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="numero_iscritti"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Url al corso
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="url_corso"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Nome del docente
		</td>
                <td>
		<c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="docente"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
                <td>
		Email del docente</span></div>
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="email"></jsp:getProperty></c:if>
		</td>
		</tr>
		<tr>
		<td>
		Note del docente
		</td>
		<td style="width:70%">
                <c:if test="${Dettagli_corsi != null}"><jsp:getProperty name = "Dettagli_corsi" property="note"></jsp:getProperty></c:if>
		</td>
		</tr>
	</table>
                       
    </div>
    <div class="tab-pane" id="tab2">
        
    	<table class="table table-bordered" style="width:688px" id="table_studenti">
		<tr>
		<th style="width:20%">
		Nome
		</th>
		<th style="width:20%">
		Cognome
		</th>
		<th style="width:20%">
		Matricola
		</th>
		<th style="width:20%">
		Data appello
		</th>
		<th style="width:20%">
		Voto
		</th>
		</tr>
                
                 <c:if test="${studenti != null}">
                <c:forEach items="${studenti}" var="studente">
                        <tr>
                        <td><c:out value="${studente.nome}"/></td>
                        <td><c:out value="${studente.cognome}"/></td>
                        <td><c:out value="${studente.matricola}"/></td>
                        <td><c:out value="${studente.data_appello}"/></td>
                        <td id="${studente.matricola}"><c:out value="${studente.getVoto()}"/>

                                    <c:if test="${studente.is_finished == false}">
                                       <a href="#" class="cambiavoto"> (modifica) </a> 
                                    </c:if>
                        </td>
                        </tr>            
                        
                </c:forEach>
                 </c:if>
               
                 
        </table>
              
    </div>
</div>
</body>
</html>
